Skip to content

Conversation

bendikto
Copy link
Owner

@bendikto bendikto commented Oct 5, 2026

compute_metrics called pd.read_json() directly on a JSON string (raw_data["financials"] / raw_data["balance_sheet"]), which already triggered a FutureWarning on every test run: pandas will eventually remove support for passing a literal string this way (it ends up guessing whether the string is content or a file path), turning this into a hard crash rather than just a warning.

Wrap both strings in io.StringIO before passing them to pd.read_json, which is the way pandas wants this going forward.

Verified with pytest -W error::FutureWarning: no FutureWarning is
raised anymore. Full suite: 40 passed, 92% coverage on src/.

Closes #10

compute_metrics called pd.read_json() directly on a JSON string
(raw_data["financials"] / raw_data["balance_sheet"]), which already
triggered a FutureWarning on every test run: pandas will eventually
remove support for passing a literal string this way (it ends up
guessing whether the string is content or a file path), turning this
into a hard crash rather than just a warning.

Wrap both strings in io.StringIO before passing them to pd.read_json,
which is the way pandas wants this going forward.

Verified with `pytest -W error::FutureWarning`: no FutureWarning is
raised anymore. Full suite: 40 passed, 92% coverage on src/.

Closes #10
@bendikto bendikto added Src Core backend logic, algorithmic development, math engines, and internal system architecture changes /MAINTENANCE : Scheduled updates, code refactoring, and infrastructure adjustments labels Oct 5, 2026
@bendikto bendikto self-assigned this Oct 5, 2026
@bendikto bendikto merged commit f9f80a4 into main Oct 5, 2026
@bendikto bendikto deleted the 10-Fix-deprecated-pd.read_json-string-usage-in-metrics_engine branch October 5, 2026 18:54
Sign in to join this conversation on GitHub.
Labels
/MAINTENANCE : Scheduled updates, code refactoring, and infrastructure adjustments Src Core backend logic, algorithmic development, math engines, and internal system architecture changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix deprecated pd.read_json string usage in metrics_engine
1 participant